//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//

//
#ifndef Green_PageRequestRegulatorGPGPU_H
#define Green_PageRequestRegulatorGPGPU_H

#include "PageRequestRegulator.h"

namespace Green {

  class RegisterFile;
  class RegisterField;
  class GenCondition;

  /*!
    \class PageRequestRegulatorGPGPU
    \brief GPGPU layer class regulating GenPageRequest object before passing it to Paging system.
  */
  class PageRequestRegulatorGPGPU : public PageRequestRegulator {
  public:
    Object* Clone() const override;  //!< Return a cloned object of the same type and same contents of the PageRequestRegulatorGPGPU object.
    const char* Type() const override { return "PageRequestRegulatorGPGPU"; } //!< Return a string describing the actual type of the PageRequestRegulatorGPGPU object

    PageRequestRegulatorGPGPU(); //!< Default constructor.
    ~PageRequestRegulatorGPGPU(); //!< Destructor.

    void Setup(const Generator* pGen) override; //!< Setup the PageRequestRegulatorGPGPU object.
    void RegulateLoadStorePageRequest(const VmMapper* pVmMapper, const LoadStoreOperandStructure* pLsStruct, GenPageRequest* pPageReq) const override; //!< Regulate load-store type page request object, GPGPU layer.
    void RegulateBranchPageRequest(const VmMapper* pVmMapper, const BranchOperandStructure* pBrStruct, GenPageRequest* pPageReq) const override; //!< Regulate branch type page request object, GPGPU layer.
  protected:
    PageRequestRegulatorGPGPU(const PageRequestRegulatorGPGPU& rOther); //!< Copy constructor.
    ASSIGNMENT_OPERATOR_ABSENT(PageRequestRegulatorGPGPU);
    //void PreventDataPageFault(GenPageRequest* pPageReq) const override; //!< Setup the page request object to prevent GPGPU data aborts.
    //void PreventInstrPageFault(GenPageRequest* pPageReq) const override; //!< Setup the page request object to prevent GPGPU instruction aborts.
  };

}

#endif
